package com.zhuiyun.project.cyclingapplet.controller;

import com.alibaba.fastjson2.JSONObject;
import com.zhuiyun.project.cyclingapplet.entity.CyclingUser;
import com.zhuiyun.project.cyclingapplet.service.ICyclingUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author guojingzhi
 * @since 2024-07-16
 */
@RestController
@RequestMapping("/cyclingapplet/cyclingUser")
public class CyclingUserController {

    @Autowired
    ICyclingUserService cyclingUserServicer;


    @RequestMapping("/selectUser")
    public Map<String, Object> selectUser(@RequestBody String StrReq)
    {
        JSONObject jsonObject = JSONObject.parseObject(StrReq);
        Integer id = jsonObject.getInteger("id");
        CyclingUser cylingUser = cyclingUserServicer.selectUser(id);
        Map<String,Object> m = new HashMap<>();
        m.put("msg","success");
        m.put("data", cylingUser);
        System.out.println("123：："+cylingUser);
        return m;
    }

}
